//
//  PatternModel.m
//  Mahjong
//
//  Created by 饶首建 on 17/5/28.
//  Copyright © 2017年 com.ikamobile.com. All rights reserved.
//

#import "PatternModel.h"

@implementation PatternModel

+ (void)loadPatternDataSuccess:(LoadSuccess)success fail:(LoadFail)fail{
    NSString *url = [BASE_URL stringByAppendingPathComponent:API_GET_PATTERN];
    [HttpUtil sendRequestURL:url method:GET param:nil success:^(id response) {
        PatternModel *pm = [PatternModel new];
        pm.huPatternArr = response[@"胡"];
        pm.gangPatternArr = response[@"杠"];
        pm.chaPatternArr = response[@"查叫"];
        pm.optionalHuPatternArr = response[@"胡可选"];
        pm.optionalChaPatternArr = response[@"查叫可选"];
        pm.tagsPatternArr = response[@"tags"];
        success(pm);
    } fail:^(NSString *errorStr) {
        fail(errorStr);
    }];
}

+(void)loadRuleSuccess:(LoadSuccess)success fail:(LoadFail)fail{
    NSString *url = [BASE_URL stringByAppendingPathComponent:API_GET_RULE];
    [HttpUtil sendRequestURL:url method:GET param:nil success:^(id response) {
        PatternModel *pm = [PatternModel new];
        pm.ruleArr = response;
        success(pm);
    } fail:^(NSString *errorStr) {
        fail(errorStr);
    }];
}


@end
